#include<reg51.h>
void delay1s(int ms);
char LED[8] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; 
sbit buz = P2^0;
void main()
{
    char i = 0; 
    while(1)
	{
	    for(i=0;i<8;i++)

        {
        P1=~LED[i];
		buzz = 0;
        delay1s(500);
		P1 = 0xff;
		buzz = 1;
        delay1s(500);
        }   
	}  
}

void delay1s(int ms)
{
int i = 0,j = 0;

for(i = ms;i > 0;i--)
{
    for(j = 123;j > 0;j--);
}
}